<template>
  <header>
    <!--    设置左侧-->
    <div class="l-content">
      <el-button @click="changeMenu" plain icon="el-icon-menu" size="mini"></el-button>
      <h3 >设计人员 ： 李雨翰  李玫洁  薛浩男  杨泽晨  高艺杰</h3>
    </div>
    <!--    设置右侧-->
    <div class="r-content">
      <el-dropdown trigger="click" size="mini">
        <span>
          <img class="user" :src="userImg">
        </span>
        <el-dropdown-menu slot="dropdown">
          <el-dropdown-item @click.native="logout">安全退出</el-dropdown-item>
        </el-dropdown-menu>
      </el-dropdown>
    </div>
  </header>
</template>

<script>
export default {
  name: "CommonHeader",
  data() {
    return {
      //引入头像图片
      userImg: require('../assets/img/avator.jpg')
    }
  },
  methods: {
    logout(){  //退出登陆操作
      localStorage.removeItem("Authorization")  //删除用户Token
      this.$router.push('/')  //跳转回主页面
      this.$message({
        type: 'info',
        message: '您已安全退出系统'
      })
    },
    changeMenu() {
      this.$store.commit('collapseMenu')  //提交方法
    }
  }
}
</script>

<style lang="less" scoped>
header {
  display: flex;
  height: 100%;
  width: 100%;
  justify-content: space-between;
  align-items: center;
  background-color: #333333;
}

.l-content {
  display: flex;
  align-items: center;

  .el-button {
    margin-right: 20px;
    margin-left: 20px;
  }
    text-align: center;
    font-size: 20px;
    font-family: "隶书";
    color: wheat;
    letter-spacing: 0;
    text-shadow: 0 1px 0 #999,
    0 1px 0 #444,
    0 2px 0 #333,
    0 3px 0 #222,
    0 4px 0 #111
}

.r-content {
  .user {
    margin-right: 20px;
    margin-left: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
  }
}
</style>
